const material = [
  {
    id: 1,
    goodsName: '切片胡萝卜',
    supplierName: '新鲜农庄',
    principal: '李先生',
    place: '本地农田',
    quantity: '1000',
    price: '10000',
    date: '2020-05-26T09:42:56Z',
  },
  {
    id: 2,
    goodsName: '蒸熟土豆块',
    supplierName: '优品食品公司',
    principal: '王女士',
    place: '农户合作社',
    quantity: '500',
    price: '2240',
    date: '2020-05-26T09:42:56Z',
  },
  {
    id: 3,
    goodsName: '炖煮牛肉块',
    supplierName: '肉品批发商',
    principal: '刘先生',
    place: '澳大利亚',
    quantity: '200',
    price: '16000',
    date: '2020-05-26T09:42:56Z',
  },
  {
    id: 4,
    goodsName: '蒸熟西兰花',
    supplierName: '优品食品公司',
    principal: '王女士',
    place: '农户合作社',
    quantity: '300',
    price: '1260',
    date: '2020-05-26T09:42:56Z',
  },
  {
    id: 5,
    goodsName: '切片胡萝卜',
    supplierName: '农产品批发市场',
    principal: '张先生',
    place: '山东省',
    quantity: '600',
    price: '1800',
    date: '2020-05-26T09:42:56Z',
  },
  {
    id: 6,
    goodsName: '炖煮鸡肉块',
    supplierName: '肉品批发商',
    principal: '刘先生',
    place: '广东',
    quantity: '150',
    price: '9000',
    date: '2020-05-26T09:42:56Z',
  },
];

export default {
  'GET /api/material': (req: any, res: any) => {
    res.json({
      success: true,
      data: { material },
      errorCode: 0,
    });
  },
  'POST /api/material/add': (req: any, res: any) => {
    material.push({ id: material.length + 1, ...req.body });
    res.send({
      code: 200,
      success: true,
      message: '成功',
      data: req.body,
    });
  },
  'POST /api/material/delect': (req: any, res: any) => {
    res.json({
      success: true,
      data: req.id,
    });
  },
};
